﻿#include "FITKCGNSData.h"

namespace IO
{
    BaseDataStruct::~BaseDataStruct()
    {

    }

    void BaseDataStruct::setBaseInfo(QString name, int cDim, int pDim)
    {
        m_baseName = name;
        m_cell_dim = cDim;
        m_phys_dim = pDim;
    }

    int BaseDataStruct::getZoneCount()
    {
        return m_zoneDatas.size();
    }

    ZoneDataStruct* BaseDataStruct::getZoneData(int index)
    {
        if (index < 0 || index >= m_zoneDatas.size())return nullptr;
        return &m_zoneDatas[index];
    }

    void BaseDataStruct::setZoneSize(int size)
    {
        if (size < 0)return;
        m_zoneDatas.fill(ZoneDataStruct(), size);
    }

    FamiltyDataStruct* BaseDataStruct::getFamiltyData(int index)
    {
        if (index < 0 || index >= m_familty.size())return nullptr;
        return &m_familty[index];
    }

    void BaseDataStruct::setFamiltySize(int size)
    {
        if (size < 0)return;
        m_familty.fill(FamiltyDataStruct(), size);
    }

    bool BaseDataStruct::isAllZoneType(int zoneType)
    {
        if (m_zoneDatas.isEmpty()) return false;
        for (int i = 0; i < m_zoneDatas.count(); ++i)
        {
            if (m_zoneDatas[i].zoneType == zoneType)continue;
            return false;
        }
        return true;
    }

    FITKCGNSData::~FITKCGNSData()
    {

    }

    int FITKCGNSData::getBaseCount()
    {
        return m_baseDatas.size();
    }

    BaseDataStruct* FITKCGNSData::getBaseData(int index)
    {
        if (index < 0 || index >= m_baseDatas.size())return nullptr;
        return &m_baseDatas[index];
    }

    void FITKCGNSData::setBaseSize(int size)
    {
        if (size < 0)return;
        m_baseDatas.fill(BaseDataStruct(), size);
    }

    void FITKCGNSData::setFileType(FileTypeEnum type)
    {
        m_file_type = type;
    }
    void FITKCGNSData::setFileVersion(float version)
    {
        m_fileVersion = version;
    }
    void FITKCGNSData::setFilePrecision(int precision)
    {
        m_filePrecision = precision;
    }
}
